<template>
    <div>
        <div class="innertabbox">
            <div :class="{
                innertabitem: true,
                innertabactive: currentTab === item.value
            }" v-for="(item, i) in tabList" :key="i" @click="onChangeTab(item.value)">
                {{ item.label }}
            </div>
        </div>
        <keep-alive>
            <component :type="currentTab" :is="components[currentTab as keyof typeof components]" />
        </keep-alive>
    </div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import BulletRechargeApproval from './components/bullet-recharge-approval.vue'
import EleRechargeApproval from './components/ele-recharge-approval.vue'
import DayRechargeApproval from './components/day-recharge-approval.vue'
import LongRechargeApproval from './components/long-recharge-approval.vue'
import TyRechargeApproval from './components/ty-recharge-approval.vue'
import MsgRechargeApproval from './components/msg-recharge-approval.vue'
const currentTab = ref(0)
const tabList = ref([
    {
        value: 0,
        label: '子弹发薪'
    },
    {
        value: 1,
        label: '电子签'
    },
    {
        value: 2,
        label: '保险产品'
    },
    // {
    //     value: 5,
    //     label: '群发消息'
    // }
])
const components = {
    0: BulletRechargeApproval,
    1: EleRechargeApproval,
    2: DayRechargeApproval,
    3: LongRechargeApproval,
    4: TyRechargeApproval,
    5: MsgRechargeApproval,
}

const onChangeTab = (i: number) => {
    currentTab.value = i
}
</script>

<style lang="scss" scoped>
.innertabactive {
    color: #0256ff !important;
    font-weight: 700;
    background-color: #ffffff !important;
    border-color: #ffffff !important;
}

.innertabbox {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;

    .innertabitem {
        cursor: pointer;
        min-width: 90px;
        height: 41px;
        text-align: center;
        line-height: 41px;
        color: #a7aab2;
        font-size: 14px;
        background-color: #efeef1;
        border-top-right-radius: 8px;
        border-top-left-radius: 8px;
        border-top: 1px solid #e3e0e8;
        border-right: 1px solid #e3e0e8;
    }
}
</style>
